A memory card such as an SD (Secure Digital) card (a registered trademark) that is a semiconductor recording card incorporating a flash memory is extremely small and extremely thin, and recently the memory card has been widely used to record data, for example, image data in a digital camera, a mobile phone, and the like owing to ease of handling.
The flash memory incorporated in the semiconductor recording device such as the memory card is a memory able to erase and rewrite data in units of blocks of a predetermined size, and has the limited number of times of the rewritings.
In the flash memory, data cannot be overwritten to a recorded page. In a case of updating data, the flash memory erases all pages of a physical block in a lump by erasing the physical block that is an erasing unit, and writes data in units of the pages. For example, in a case where all pages of a certain physical block have already-written data and only page 0 of the physical block will be updated, the updating is carried out in the following four steps.
(1) Data of all pages of the physical block is read and stored in a volatile memory.
(2) Only page 0 is updated in the volatile memory.
(3) The physical block is erased.
(4) The data in the volatile memory is written to all pages of the physical block.
However, the above-mentioned method has the following problem.
Since data cannot be written in the bad physical block in a case where a physical block turns into a bad physical block, a conversion table between a logical block number and a physical block number is introduced, and when the physical block has turned into a bad physical block, the data is written in a physical block to which different physical block number is added. Accordingly, a method for: preliminarily securing physical blocks of only the estimated number of occurrences of bad blocks extra; when a writing error has occurred, registering a block where the writing error occurred as an error block; and writing data to a physical block other than the error block is employed.
In addition, the flash memory has a life time of the number of times of rewriting; however only the same physical block may be rewritten many times. In the present circumstances, the physical block can be rewritten approximately 100,000 times, and thus a probability of occurrence of the writing error increases in the case where the rewriting is performed more than 100,000 times.
For example, in the case of recording a motion picture in the flash memory in real time, when the writing error frequently occurs, a writing speed to the flash memory becomes lower than a speed at which a generated image is sent to the flash memory. Accordingly, there will be a problem that the motion picture cannot be continuously recorded.
Patent document 1 discloses a conventional technique for ostensibly increasing the number of times of rewriting of the memory to delay the occurrence of this problem. The conventional technique divides the memory into a plurality of regions and stores the number of times of rewriting on each region. The technique controls the rewriting of the memory on the basis of the stored numbers of times of rewriting of each region so that a difference between the respective numbers of times of rewriting of each region can be small, namely, so that a region with the small number of times of rewriting can be preferentially used. Meanwhile, the method for controlling the difference between the respective numbers of times of rewriting of each region to be small is called a leveling. When the conventional technique is applied to the memory card, a physical block in which data is actually written changes in the flash memory even in the case where data is written in the same logical block. When the leveling is perfectly carried out, the possible number of times of rewriting increases up to (Size of memory card/Size of rewritten block)×(The possible number of times of rewriting in each rewritten block).
However, in Patent document 1, the leveling can increase the number of times of rewriting, but the number of times of rewriting cannot be recorded so as to be actually visible and a life time of the memory card cannot be informed to a user.
In Patent document 2, the inventor proposed a memory card comprising: a rewriting number count part for counting the number of times of rewriting that is the number of blocks used when data has been written in a flash memory in response to a command from a host apparatus; a rewriting number reading part for reading the total number of times of rewriting written in the flash memory; a rewriting number writing part for newly obtaining the total number of times of rewriting that is a total count value from the initial rewriting on the basis of the number of times of rewriting counted by the rewriting number count part and the total number of times of rewriting read by the rewriting number reading part and for writing the obtained total number of times of rewriting in the flash memory. The rewriting number writing part is characterized by writing the obtained total number of times of rewriting in the flash memory at a time when the number of times of rewriting after the previous writing of the total number of times of rewriting has reached a predetermined number of times or more.
In a camera recorder and the like for recording image data, when data of total capacity of the memory card has been recorded, the data is transferred to an HDD and the like and then the memory card is formatted to be used again for the recording. In such usage, (Physical block size)×(The number of times of rewriting/Size) is nearly same as an upper limitation value of the number of times of rewriting of the semiconductor memory.    Patent document 1: Japanese Unexamined Patent Publication No. H06-302194    Patent document 2: Japanese Unexamined Patent Publication No. 2005-284659